import { useInjectable } from '@/unit/hooks/use-di';
import React, { useEffect, useState } from 'react';
import { AtActionSheet, AtActionSheetItem } from 'taro-ui';
import { Sheet as SheetModule } from './Sheet.module';

const Sheet = () => {
  const sheet = useInjectable(SheetModule);

  const [visible, setVisible] = useState(false);

  useEffect(() => {
    console.log('visi', sheet.visible);
    setVisible(sheet.visible);
  }, [sheet.visible]);

  return (
    <AtActionSheet isOpened={visible} onClose={() => setVisible(false)}>
      <AtActionSheetItem>按钮一</AtActionSheetItem>
      <AtActionSheetItem>按钮二</AtActionSheetItem>
    </AtActionSheet>
  );
};

export default Sheet;
